package com.alliky.classify.ui.adapter

import androidx.recyclerview.widget.DiffUtil
import com.alliky.classify.R
import com.rrc.common.entity.GoodsVO
import com.alliky.core.base.BasePagingAdapter

/**
 * ================================================
 * @Description: 描述
 * @Author: wxianing
 * @Date: 2022/11/24 16:22
 * ================================================
 */
class ClassifyHotsAdapter : BasePagingAdapter<GoodsVO>(differCallback) {

    companion object {
        val differCallback = object : DiffUtil.ItemCallback<GoodsVO>() {
            override fun areItemsTheSame(oldItem: GoodsVO, newItem: GoodsVO): Boolean {
                return oldItem.id == newItem.id
            }

            override fun areContentsTheSame(oldItem: GoodsVO, newItem: GoodsVO): Boolean {
                return oldItem == newItem
            }
        }
    }

    override fun getItemLayout(position: Int): Int = R.layout.item_category_hots_layout

    override fun convert(holder: OnBindViewHolder, item: GoodsVO?) {
        holder.setText(R.id.tv_name, item?.goods_name)
//        holder.setText(R.id.tv_price, "￥" + item?.goods_price)
        holder.setImage(R.id.iv_image, item?.goods_thumb)
    }

}